package com.yneusoft.manage.controller;


import com.yneusoft.common.model.ResponseWrapper;
import com.yneusoft.manage.model.param.*;
import com.yneusoft.manage.service.StaffManageService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class StaffManageController {
    @Resource
    private StaffManageService staffManageService;

    /**
     * 获取员工状态列表
     */
    @GetMapping("/staffManage/getStaffStateList")
    public ResponseWrapper getStaffStateList() {
        return staffManageService.getStaffStateList();
    }

    /**
     * 获取员工列表
     */
    @GetMapping("/staffManage/getStaffList")
    public ResponseWrapper getStaffList(GetStaffListParam param){
        return staffManageService.getStaffList(param);
    }

    /*
    * 3、【新增/修改员工】获取员工修改信息
    * */
    @GetMapping("/staffManage/getStaffInfo")
    public ResponseWrapper getStaffInfo(UpdateStaffInfoParam param){
        return staffManageService.getStaffInfo(param);
    }

    /**
     * 4、【新增/修改员工】校验相同手机的其他员工是否存在
     */
    @GetMapping("/staffManage/checkStaffPhone")
    public ResponseWrapper checkStaffPhone(@Validated CheckStaffPhoneParam param) {
        return staffManageService.getStaffPhoneList(param);
    }

    /**
     * 5、【新增/修改员工】校验相同身份证号的其他员工是否存在
     */
    @GetMapping("/staffManage/checkStaffIdNumber")
    public ResponseWrapper checkStaffIdNumber(@Validated CheckStaffIdNumberParam param) {
        return staffManageService.getStaffIdNumber(param);
    }

    /*
    * 6、获取员工所在部门
    * */
    @GetMapping("/staffManage/getStaffDepartment")
    public ResponseWrapper getStaffDepartmentList(GetStaffDepartmentListParam param) {
        return staffManageService.getStaffDepartment(param);
    }

    /*
    * 7、【新增 / 修改员工】新增/修改员工信息
    * */
    @PostMapping("/staffManage/saveStaff")
    @ResponseBody
    public ResponseWrapper saveStaff(@RequestBody SaveStaffParam param){
        return staffManageService.saveStaff(param);
    }

    /**
     *
     * 8、【离职/重新入职】更改员工状态
     */
    @PostMapping("/staffManage/updateStaffState")
    public ResponseWrapper updateStaffState(@RequestBody UpdateStaffStateParam param) {
        return staffManageService.updateStaffStateById(param);
    }

}


